package com.ymk.cmd;


import com.ymk.base.cmd.ACmd;
import com.ymk.base.cmd.CmdSign;
import com.ymk.core.code.cmd.RbacCmdCode;
import com.ymk.bo.rbac.RbacRoleBO;
import com.ymk.service.IRbacRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service
public class RbacRoleDelCmd extends ACmd {

    @Override
    public CmdSign executeSop(HttpServletRequest request, CmdSign sign) throws Exception {
        CmdSign respSign = new CmdSign(sign);
        RbacRoleBO rbacRoleBO = super.getData(sign, RbacRoleBO.class);
        this.rbacRoleService.del(rbacRoleBO);
        return respSign;
    }

    @Override
    public CmdSign executeMop(HttpServletRequest request, CmdSign sign) throws Exception {
        CmdSign respSign = new CmdSign(sign);
        RbacRoleBO rbacRoleBO = super.getData(sign, RbacRoleBO.class);
        this.rbacRoleService.del(rbacRoleBO);
        return respSign;
    }


    @Override
    public boolean anon(CmdSign sign) {
        return true;
    }

    @Override
    public String getCmdCode() {
        return RbacCmdCode.RBAC_ROLE_DEL;
    }

    @Autowired
    private IRbacRoleService rbacRoleService;
}
